package main

import (
	"fmt"
)

func main() {
	fmt.Println(isPalindrome(12321))
}

func isPalindrome(x int) bool {
	if x < 0 {
		return false
	}

	p, q := x, 0

	for p >= 10 {
		q *= 10
		q += p % 10
		p /= 10
	}

	return q == x/10 && p == x%10
}
